package cn.uway.controller.demo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/project")
@Controller
public class ProjectController {

	protected  Logger logger = LoggerFactory.getLogger(this.getClass());	
	
	@RequestMapping(value = "/toAdd" , method=RequestMethod.GET )
    public String  toAdd(HttpServletRequest request, HttpServletResponse response ) {    	
        return "projectAdd";  //进入Project新增页面，src/main/webapp/jsp目录下的projectAdd.jsp
    }
	
	@ResponseBody
	@RequestMapping(value = "/add" , method=RequestMethod.POST )
    public String  add(HttpServletRequest request, HttpServletResponse response ) {    
		String json = ""; //调用接口，新增数据，返回json
        return json;  //作为ajax请求，输出JSON串给浏览器
    }
	
	@RequestMapping(value = "/toUpdate" , method=RequestMethod.GET )
    public String  toUpdate(HttpServletRequest request, HttpServletResponse response ) {   
		//调用接口，根据projectId参数获取Project数据
		//request.setAttribute("project", project); //将project信息传给jsp页面显示
        return "projectUpdate";  //进入Project修改页面，src/main/webapp/jsp目录下的projectUpdate.jsp
    }
	
}
